package com.bwie.xujiahaonewstitle.httputils;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
//http://www.jianshu.com/p/dda4645c824f  对 RecyclerView.ItemDecoration 这个类不懂得自主学习
public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
    //给RecyclerView每个小item之间设置间距
    private int mSpace;

    public SpaceItemDecoration(int space) {
        mSpace = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        outRect.left = mSpace;
        outRect.top = 0;
        outRect.right = mSpace;
        outRect.bottom = mSpace;
    }
}
